package com.giteelou.antlr.ps.man.symbol;

import org.antlr.v4.runtime.tree.ParseTree;

/**
 * Symbol的抽象实现
 */
public abstract class AbstractSymbol implements Symbol {
    private final String name;
    private final ParseTree node;

    /**
     *
     * @param name Symbol的名称
     * @param node Symbol关联的AST节点
     */
    public AbstractSymbol(String name, ParseTree node) {
        this.name = name;
        this.node = node;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public ParseTree getNode() {
        return node;
    }

    @Override
    public String toString() {
        return "Symbol: " + name;
    }
}
